package com.httpDemo;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
//@ComponentScan("com") // 注解扫描，默认是扫描该配置类同包以及子包下的类，即com.httpDemo下的类
@ImportResource(value = { "classpath:beans.xml" }) // 如果非要用xml配置文件，可使用该注解
@MapperScan(basePackages = { "com.httpDemo.mapper" }) // mybatis注解扫描
@EnableTransactionManagement // 开启事务注解
@EnableSwagger2 // 开启swagger注解
//@EnableKnife4j // 启用Knife4j提供的增强功能
@EnableCaching // 开启缓存
public class Application {

	public static void main(String[] args) {
		SpringApplication application = new SpringApplication(Application.class);
//		application.setBannerMode(Mode.OFF); // 去掉banner
		application.run(args);
	}

	@Bean
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
}
